import request from "@/lib/request";
import {API} from "@/api/typings";

/** userRegistry POST /user/registry */
export async function userRegistryUsingPost(
  body: API.UserRegisterRequest,
  options?: { [key: string]: any },
): Promise<API.BaseResponse<boolean>> {
  return request("/user/registry", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** userLogin POST /user/login */
export async function userLoginUsingPost(
  body: API.UserLoginRequest,
  options?: { [key: string]: any },
): Promise<API.BaseResponse<API.UserVO>> {
  return request("/user/login", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** userLogout POST /user/logout */
export async function userLogoutUsingPost(options?: {
  [key: string]: any;
}): Promise<API.BaseResponse<boolean>> {
  return request("/user/logout", {
    method: "POST",
    ...(options || {}),
  });
}

/** getPageUser Post /user/page */
export async function getUserListByPage(
  body: API.UserQueryRequest,
  options?: { [key: string]: any },
): Promise<API.BaseResponse<API.UserVO>> {
  return request("/user/page", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** getLoginUser GET /user/getLoginInfo */
export async function getLoginUserUsingGet(options?: {
  [key: string]: any;
}): Promise<API.BaseResponse<API.UserVO>> {
  return request("/user/getLoginInfo", {
    method: "GET",
    ...(options || {}),
  });
}

/** listUserByPage POST /user/page */
export async function listUserByPageUsingPost(
  body: API.UserQueryRequest,
  options?: { [p: string]: any },
): Promise<API.BasePageResponse<API.UserVO>> {
  return request("/user/page", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** deleteUser GET /user/remove */
export async function deleteUserUsingGet(
  params: API.BaseParamsID,
  options?: { [key: string]: any },
): Promise<API.BaseResponse<boolean>> {
  return request("/user/remove", {
    method: "GET",
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** addUser POST /user/add */
export async function addUserUsingPost(
  body: API.UserAddRequest,
  options?: { [key: string]: any },
): Promise<API.BaseResponse<boolean>> {
  return request("/user/add", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** updateUser POST /user/update */
export async function updateUserUsingPost(
  body: API.UserUpdateRequest,
  options?: { [key: string]: any },
): Promise<API.BaseResponse<boolean>> {
  return request("/user/update", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}
